package foundation.web.flow;

import org.zkoss.zk.ui.Component;
import org.zkoss.zkplus.databind.AnnotateDataBinder;

import ar.com.sne.bean.BaseBO;

import foundation.common.util.CommonWebUtil;


/**
 * @author Florencia Maneiro
 */
/**
 * This class implements the abstract behaviour of Navigation manager composer
 * 
 * 
 */
@SuppressWarnings("unchecked")
public abstract class AbstractNavigationComposer extends
		AbstractDestinationComposer {	
	
	public AnnotateDataBinder binder;
	private boolean back=false;
	
	@Override
	public void doAfterCompose(Component comp) throws Exception {

		super.doAfterCompose(comp);
		// This sentences is to restore the state composer
		CommonWebUtil.restoreComposer(this);
	}

	/**
	 * Definition of methods to be called in the navigation
	 * 
	 * @return the list in order of composer methods that will call when the
	 *         action "restoreComposer" is called
	 */
	protected abstract void callMethods();

	public void callBinderAll(){
		if(this.getBinder()!=null){
			this.getBinder().loadAll();
		}
	}	
	public void loadComponent(Component component){
		if(this.getBinder()!=null){
			this.getBinder().loadComponent(component);
		}
	}
	
	public AnnotateDataBinder getBinder(){
		return binder;
	}
	

	public BaseBO getNewObjectPersistentObjectToAdd(){
		return null;
	}

	public boolean isBack() {
		return back;
	}

	public void setBack(boolean back) {
		this.back = back;
	}
	
	
}
